var s = jQuery("input[name\x3d'Glod']").bind("click", function() {
	var a = jQuery(this).attr("text"),
		b = jQuery(this).attr("cmd");
	jQuery("#Unit").val(a);
	jQuery("#Command").val(b)
});

function addmagic() {
	var a = jQuery(".magic tr").length - 2;
	jQuery('\x3ctr\x3e\x3cth\x3e\u5145\u503c\uff1a\x3c/th\x3e\x3ctd\x3e\x3cinput id\x3d"MagicMoney" name\x3d"MagicMoney" style\x3d"width:80px;" type\x3d"text" value\x3d"" class\x3d"form-control" /\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput id\x3d"MagicCmd" name\x3d"MagicCmd" style\x3d"width:80px;" type\x3d"text" value\x3d"Give" class\x3d"form-control"/\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput id\x3d"MagicName" name\x3d"MagicName" size\x3d"30" type\x3d"text" value\x3d"" class\x3d"form-control"/\x3e \x3cinput type\x3d"button" value\x3d"\u5220\u9664" class\x3d"btn btn-green" onclick\x3d"removemagic(this)" /\x3e\x3c/td\x3e\x3c/tr\x3e').insertAfter(jQuery(".magic tr:eq(" + a + ")"));
	rest()
}

function removemagic(a) {
	a = jQuery(a).parent().parent().index();
	jQuery(".magic tr:eq(" + a + ")").remove();
	rest()
}

function addencourage() {
	var a = jQuery(".encourage tr").length - 2;
	jQuery('\x3ctr\x3e\x3cth\x3e\u5145\u503c\uff1a\x3c/th\x3e\x3ctd\x3e\x3cinput id\x3d"PayMoney" name\x3d"PayMoney" style\x3d"width:80px;" type\x3d"text" value\x3d"" class\x3d"form-control"/\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput id\x3d"GiveMoney" name\x3d"GiveMoney" style\x3d"width:80px;" type\x3d"text" value\x3d"" class\x3d"form-control"/\x3e \x3cinput type\x3d"button" value\x3d"\u5220\u9664" class\x3d"btn btn-green" onclick\x3d"removencourage(this)" /\x3e\x3c/td\x3e\x3c/tr\x3e').insertAfter(jQuery(".encourage tr:eq(" + a + ")"));
	a = jQuery(".content");
	jQuery(".content").height(a + 40);
	rest()
}

function removencourage(a) {
	a = jQuery(a).parent().parent().index();
	jQuery(".encourage tr:eq(" + a + ")").remove();
	rest()
}

function insertIntegral() {
	var a = jQuery(".integral tr").length - 2;
	jQuery('\x3ctr\x3e\x3cth\x3e\u53d8\u91cf\uff1a\x3c/th\x3e\x3ctd\x3e\x3cinput id\x3d"VarName" name\x3d"VarName" style\x3d"width:80px;" type\x3d"text" value\x3d"" class\x3d"form-control"/\x3e\x3c/td\x3e\x3ctd style\x3d"width:60px; text-align:center"\x3e\x3cinput type\x3d"checkbox" onclick\x3d"Changed(this)" class\x3d"checkbox"/\x3e\x3cinput type\x3d"hidden" name\x3d"showMsg" value\x3d"0" /\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput id\x3d"VarPath" name\x3d"VarPath" style\x3d"width:300px;" type\x3d"text" value\x3d"" class\x3d"form-control"/\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput id\x3d"IntegralScale" name\x3d"IntegralScale" style\x3d"width:80px;", maxlength \x3d 8" type\x3d"text" value\x3d""  class\x3d"form-control"/\x3e \x3cinput type\x3d"button" value\x3d"\u5220\u9664" class\x3d"btn btn-green" onclick\x3d"deleteIntegralrow(this)" /\x3e\x3c/td\x3e\x3c/tr\x3e').insertAfter(jQuery(".integral tr:eq(" + a + ")"));
	rest()
}

function deleteIntegralrow(a) {
	a = jQuery(a).parent().parent().index();
	jQuery(".integral tr:eq(" + a + ")").remove();
	rest()
}

function Changed(a) {
	var b = jQuery(a).parent().find("input[name\x3d'showMsg']");
	jQuery(a).is(":checked") ? b.val(1) : b.val(0)
}

function Selengine() {
	var a = jQuery("#EngineName").val(),
		a = a.toLocaleLowerCase();
	"herom2" == a || "gameofmir" == a || "gee" == a ? (jQuery("#EngineCommand").val("OpenWebSite"), document.getElementsByName("AddonCommand")[1].value = "ChangeNationCredit + ") : (document.getElementsByName("AddonCommand")[1].value = "CHANGEGLORY + ", "3km2" == a || "bluem2/legendm2" == a || "maxm2" == a ? jQuery("#EngineCommand").val("WebBrowser") : "\u4f20\u4e16" == a ? jQuery("#EngineCommand").val("@@url") : jQuery("#EngineCommand").val(""))
}

function insertNpc() {
	var a = jQuery(".Npc tr").length - 2;
	jQuery('\x3ctr\x3e\x3cth\x3e\u5730\u56fe\uff1a\x3c/th\x3e\x3ctd\x3e\x3cinput type\x3d"text" name\x3d"Map" size\x3d"5",maxlength\x3d"5" class\x3d"form-control"/\x3e X\uff1a\x3cinput type\x3d"text" name\x3d"X" size\x3d"5",maxlength\x3d"5" class\x3d"form-control"/\x3e Y\uff1a\x3cinput type\x3d"text" name\x3d"Y" size\x3d"5",maxlength\x3d"5" class\x3d"form-control"/\x3e \u5916\u89c2\uff1a\x3cinput type\x3d"text" name\x3d"S" size\x3d"5",maxlength\x3d"5" class\x3d"form-control"/\x3e \x3cinput type\x3d"button" value\x3d"\u5220\u9664" class\x3d"btn btn-danger" onclick\x3d"RemoveNpc(this)" /\x3e\x3c/td\x3e\x3c/tr\x3e').insertAfter(jQuery(".Npc tr:eq(" + a + ")"));
	rest()
}

function RemoveNpc(a) {
	a = jQuery(a).parent().parent().index();
	jQuery(".Npc tr:eq(" + a + ")").remove();
	rest()
}

function showinner(a) {
	var b = jQuery(a).next();
	a = jQuery(a).children("span")[0];
	jQuery(a).hasClass("open") ? (jQuery(b).hide(), jQuery(a).removeClass("open"), jQuery(a).addClass("close")) : (jQuery(a).removeClass("close"), jQuery(a).addClass("open"), jQuery(b).show());
	rest()
}

function setdiscount(a, b) {
	var d = a.value,
		c = document.getElementsByClassName(b);
	for(i = 0; i < c.length; i++) c[i].value = d
}

function Saveas() {
	jQuery("#isnew").val("1");
	document.forms[0].submit()
}
var m = jQuery(".node").each(function(a) {
	0 < a && jQuery(this).find("span").first().hasClass("close") && jQuery(this).find(".inner").hide()
});

function rest() {
	jQuery(".control \x3e .wrapper").height();
	var a = jQuery(".content").innerHeight();
	jQuery(".control \x3e .wrapper").height(a)
};